package com.example.finalwork06.Mapper;

import com.example.finalwork06.Entity.ChinaIndex;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface ChinaIndexMapper {
    @Select("SELECT * FROM china_index")
    public List<ChinaIndex> selectAll();

    @Select("SELECT * FROM china_index")
    public List<ChinaIndex> list();
    @Insert("INSERT INTO CHINA_INDEX(INAME,IPRICE) VALUES(#{iName},#{iPrice})")
    public void insertChinaIndex(ChinaIndex chinaIndex);

    @Select("select count(*) FROM CHINA_INDEX WHERE iName=#{name}")
    public boolean selectByName(String name);

    @Update("UPDATE CHINA_INDEX SET IPRICE=#{price} WHERE IName=#{name}")
    public void updatePrice(@Param("price")Double price, @Param("name")String name);
}
